import request from '@/utils/request'

export default {

    /**
     * 添加课程视频
     * @param {object} videoObj 课程视频对象
     * @returns 
     */
    add(videoObj) {
        return request({
            url:    `/edu/video/save`,
            method: 'post',
            data:   videoObj
        })
    },

    /**
     * 根据ID查询课程视频
     * @param {string} id 课程视频ID
     * @returns 
     */
    getById(id) {
        return request({
            url:    `/edu/video/${id}`,
            method: 'get'
        })
    },

    /**
     * 修改课程视频
     * @param {object} videoObj 课程视频对象
     * @returns 
     */
    update(videoObj) {
        return request({
            url:    `/edu/video/${videoObj.id}`,
            method: 'put',
            data:   videoObj
        })
    },

    /**
     * 删除课程视频
     * @param {string} id 课程视频ID
     * @returns 
     */
    remove(id) {
        return request({
            url:    `/edu/video/${id}`,
            method: 'delete'
        })
    },

    /**
     * 删除云端视频资源
     * @param {string} videoSourceId 云端视频资源ID
     */
    removeVideoSource(videoSourceId) {
        return request({
            url:    `/vod/remove/${videoSourceId}`,
            method: 'delete'
        })
    },

}

